package styledaco.servlet;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import comm.util.RequestManager;
import comm.util.SoptHashMap;

public class StyleDacoHttpServlet extends HttpServlet{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -3534837454030467427L;

	@SuppressWarnings("unused")
	/**
	 * Request URI를 '/'로 쪼개서 리스트로 리턴해준다.
	 * ContextPath를 제외한 해당 서블릿 url-pattern 포함
	 */
	public ArrayList<String> getRequestUrlList(HttpServletRequest request) throws UnsupportedEncodingException{
		SoptHashMap parameterMap = RequestManager.getRequest(request);
		
		String reqUrl = request.getRequestURI().replaceAll(request.getContextPath(), "");
		String items[] = reqUrl.split("/");
		
		ArrayList<String> menus = new ArrayList<String>();
		
		for(int i=0;i<items.length;i++){
			if(items[i].length()>0)menus.add(items[i]);
		}
		return menus;
	}
}
